package com.dehui.traders.ui.market.plate;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.dehui.traders.R;
import com.dehui.traders.bean.PlateListBean;
import com.dehui.traders.widgets.BaseViewHolder;
import com.dehui.traders.widgets.CommonAdapter;

import java.util.List;

import me.goldze.mvvmhabit.utils.Utils;

public class PlateItemAdapter extends CommonAdapter<PlateListBean.PlateData>{

    public PlateItemAdapter(Context context, List<PlateListBean.PlateData> mDatas) {
        super(context, mDatas, R.layout.list_item_plate_market_item);
    }

    @Override
    public void convert(BaseViewHolder helper, PlateListBean.PlateData item, int position) {

        TextView tvTitle = helper.getView(R.id.tv_title);
        TextView tvRate = helper.getView(R.id.tv_rate);
        TextView tvMsg = helper.getView(R.id.tv_msg);
        TextView tvOther = helper.getView(R.id.tv_other);
        View vLeft = helper.getView(R.id.view_left);

        tvTitle.setText(item.title);
        tvMsg.setText(item.name);
        tvRate.setText(Utils.StringToString(item.rate) + "%");
        tvOther.setText(Utils.StringToString(item.change) + " " + Utils.StringToString(item.changeRate) + "%");

        vLeft.setVisibility(position % 3 == 0 ? View.GONE : View.VISIBLE);

    }
}
